package org.javaboy.fastjson_demo;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

@RestController
public class UserController {
    @GetMapping("/user")
    public User getUser() {
        User user = new User();
        user.setBirthday(LocalDateTime.now());
        //        user.setBirthday(new Date());
        user.setId(1);
        user.setUsername("张三");
        return user;
    }

    @PostMapping("/user")
    public void addUser(@RequestBody User user) {
        System.out.println("user = " + user);
    }
}
